<?php
/**
 * Created by PhpStorm.
 * User: Inhere
 * Date: 2015/2/1
 * Time: 14:28
 * Use :
 * File: AbstractSessionHandler.php
 */

namespace ulue\parts\session\handler;


abstract class AbstractSessionHandler  implements InterfaceSessionHandler
{
    protected $prefix = null;

    public function __construct($options=[])
    {
        $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'ulue_';
    }

    public function register()
    {
        if (version_compare(phpversion(), '5.4.0', '>='))
        {
            @session_set_save_handler($this, true);
        }
        else
        {
            @session_set_save_handler(
                array($this, 'open'),
                array($this, 'close'),
                array($this, 'read'),
                array($this, 'write'),
                array($this, 'destroy'),
                array($this, 'gc')
            );
        }
    }

}// end class AbstractDriver